/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package shoppinglist;

import javax.swing.*;
import java.awt.*;
//import javax.swing.event.ListSelectionListener;
/**
 *
 * @author Student
 */
public class GroceryList extends JPanel {
    String listData[];
    private	JList listbox;
    //Controller controller;
    
    public GroceryList(String list[] ){
        //this.controller=controller;
        listData = list;
        setBackground(Color.BLACK); 
        setList();
        listbox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }
    
    private void setList(){ 
        setListbox(new JList(listData));
        getListbox().setFont(new Font("Arial",Font.BOLD,20));
        getListbox().setPreferredSize( new Dimension( 290, 550) );
        add(getListbox());       
    }

    /**
     * @return the listbox
     */
    public JList getListbox() {
        return listbox;
    }

    /**
     * @param listbox the listbox to set
     */
    public void setListbox(JList listbox) {
        this.listbox = listbox;
    }
}
